export const responseSchema = {
    type: 'object',
    properties: {
        code: {
            type: 'integer',
            description: '状态码'
        },
        success: {
            type: 'boolean',
            description: '是否成功'
        },
        message: {
            type: 'string',
            description: '提示信息'
        }
    }
};

export const successResponseSchema = {
    ...responseSchema,
    properties: {
        ...responseSchema.properties,
        data: {
            type: 'object',
            description: '返回数据'
        }
    }
};

export const errorResponseSchema = {
    description: '失败',
    content: {
        'application/json': {
            schema: responseSchema
        }
    }
};

export const successResponse = (schema: any) => ({
    description: '成功',
    content: {
        'application/json': {
            schema: {
                ...successResponseSchema,
                properties: {
                    ...successResponseSchema.properties,
                    data: schema
                }
            }
        }
    }
}); 